#include "dms.hpp"

int main()
{
    // QQ邮箱SSL配置
    std::string smtp_server = "smtp.qq.com";
    int port = 587;                               // STARTTLS端口
    std::string email_user = "1581558945@qq.com"; // 您的QQ邮箱
    std::string email_pass = "amdmrhiqfowvihgf";  // QQ邮箱授权码
    std::string sender_name = "验证码系统";

    zjx_im::SMTPSender smtp_sender_(
        smtp_server, port, email_user, email_pass, sender_name);
    std::string user_email = "3754117618@qq.com";
    auto it = user_email.find("@");
    std::stringstream body;
    body << "亲爱的 " << user_email.substr(0, it) << "：\n\n";
    body << "感谢您使用我们的服务！\n\n";
    body << "您的验证码是：\n";
    body << "【 " << "123456" << " 】\n\n";
    body << "此验证码有效期为10分钟。\n";
    body << "如果这不是您本人的操作，请忽略此邮件。\n\n";
    body << "祝您使用愉快！\n";
    body << "系统自动发送，请勿回复\n";
    // 发送邮件
    bool success = smtp_sender_.sendEmail(user_email, "", "验证码", body.str());
    return 0;
}